package org.gcu.filestorage.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.gcu.filestorage.pojo.AccountInfo;

import java.util.List;

@Mapper
public interface AccountInfoMapper {
    @Select("SELECT * FROM account_info WHERE account=#{account}")
    AccountInfo queryAccountInfo(String account);

    @Select("SELECT * FROM account_info WHERE phone_no=#{phoneNo}")
    List<AccountInfo> queryAccountInfoByPhoneNo(String phoneNo);

    @Select("SELECT * FROM account_info WHERE email=#{email}")
    List<AccountInfo> queryAccountInfoByEmail(String email);

    @Select("SELECT * FROM account_info WHERE employee_id=#{employeeId}")
    List<AccountInfo> queryAccountInfoByEmployeeId(String employeeId);

    @Select("SELECT * FROM account_info WHERE register_status=#{registerStatus}")
    List<AccountInfo> queryAccountInfoByStatus(int registerStatus);

    @Update("UPDATE account_info SET register_status=#{registerStatus} WHERE account=#{account}")
    int updateRegisterStatus(String account, int registerStatus);

    @Delete("DELETE FROM account_info WHERE account=#{account}")
    int deleteAccountInfo(String account);

    @Update("UPDATE account_info SET password=#{password} WHERE account=#{account}")
    int updatePassword(String account, String password);
}

















